import { ref } from "vue"
import { defineStore } from "pinia"

export const useQuestionStore = defineStore("question", () => {
    // 正确初始化 ref
    const currentQuestion = ref('')  // 使用圆括号
    const selectedFiles = ref([])
    const questionsessionid = ref('')
    const isNew = ref(false)
    const isGenerating = ref(false)
    

    const setCurrentQuestion = (value) => {
        currentQuestion.value = value
    }
    
    const setSelectedFiles = (value) => {
        selectedFiles.value = value
    }

    const setQuestionSessionId = (value) => {
        questionsessionid.value = value
    }
    return {
        currentQuestion,
        selectedFiles,
        questionsessionid,
        isNew,
        isGenerating,
        setQuestionSessionId,
        setCurrentQuestion,
        setSelectedFiles,
    }
    
}
,
  {
    persist: true // 开启持久化存储
  }
)